'use strict';

const Controller = require('./base');

class HomeController extends Controller {
  async index() {
    this.ctx.body = 'hi, egg';
  }

  async save() {
    const newUser = new this.ctx.model.User();
    newUser.userName = '张三';
    newUser.password = '123456';
    newUser.save();
    this.success();
  }

  async json() {
    const users = await this.ctx.model.User.find({});
    this.success(users);
  }
}

module.exports = HomeController;
